function arrayRepeat(arr){
    console.time('set');
    arr = [...new Set(arr)];
    console.log(arr);
    console.timeEnd('set');
}

function arrayRepeat2(arr){
    console.time('myRepeat');
    var temp = [];
    
    for(let i=0,j=0;i<arr.length;i++){
        if(arr[i]!==temp[j]){
            temp[j++]=arr[i];
        }
    }
    console.log(temp);
    console.timeEnd('myRepeat');
}

var arr = [1,2,3,3,3,3,4,4,6,7,8,9];
arrayRepeat(arr);
arrayRepeat2(arr);